import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../common_widget/my_webview.dart';
class QRCanResultPage extends StatefulWidget {


  String? result;
  var json;

  QRCanResultPage(this.result,this.json);

  @override
  _QRCanResultPageState createState() => _QRCanResultPageState();
}

class _QRCanResultPageState extends State<QRCanResultPage> {

  @override
  void initState() {
    // TODO: implement initState
    super.initState();

    isHTTP();

  }


  Widget? sChild;

   isHTTP(){
    if(widget.result!.contains('http')){
     return MyWebView('扫码结果','${widget.result!}');
    }
    return Scaffold(
      appBar: AppBar(
        title: Text('扫码结果'),
      ),
      body:widget.json['errcode']==100?Container(
        // color: Colors.red,
        child: Column(
          mainAxisAlignment:MainAxisAlignment.center,
          children: [
            Image.asset('images/successdown.png',width: 50,height: 50,),
            SizedBox(height: 25,),

            Text('${widget.json['data']['message']}'),
            Text('您已成功支付'),
          ],
        ),
        alignment: Alignment.center,
        width: Get.width,
        height: Get.height,
      ):Text('${widget.result}'),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // appBar: AppBar(
        // title: Text('扫码结果'),
      // ),
      body: Container(
        child: isHTTP(),
      ),
    );
  }
}
